function request(tag, data, url,token) {
    let ss = "";
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
        console.log(xhr.readyState + " " + xhr.status);
        if (xhr.readyState == 4 && xhr.status == 200 || xhr.status == 304) {
            ss = xhr.responseText;
        }

    };
    xhr.open(tag, url, false);
    //xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xhr.setRequestHeader("token", token);
    xhr.send(data);
    return ss;
}



function scheduleHtmlProvider(iframeContent = "", frameContent = "", dom = document) {
    //除函数名外都可编辑
    //以下为示例，您可以完全重写或在此基础上更改
    
    

    let baseUrl = "https://jwgl.cszyedu.cn/njwhd"
    let token = sessionStorage.getItem('Token')

    let kbjcmsid = request("post",null,baseUrl+"/Get_sjkbms",token)
    kbjcmsid = JSON.parse(kbjcmsid).data[0].kbjcmsid
    console.log(kbjcmsid)

    let teachingWeek = request("post",null,baseUrl+"/teachingWeek",token)
    teachingWeek = JSON.parse(teachingWeek).data
    console.log(teachingWeek)

    let courses=new Set()
    teachingWeek.forEach(week=>{
        let data = request("post",null,baseUrl+"/student/curriculum?week="+week.week+"&kbjcmsid="+kbjcmsid,token)
        data = JSON.parse(data).data[0].item
        data.forEach(v=>{
            courses.add(JSON.stringify(v))
console.log(data)
        })
    })
    return "["+Array.from(courses).toString()+"]"

}